package com.hnust.service.impl;

import com.hnust.api.SubjectApi;
import com.hnust.domain.*;
import com.hnust.service.SubjectService;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import retrofit2.Callback;

import java.io.File;
import java.util.List;

/**
 * 创建人：zhangRuWang
 * 创建时间：2020/10/28
 * 描述：
 */
@Service("subjectService")
public class SubjectServiceImpl implements SubjectService {
    @Autowired
    private SubjectApi subjectApi;

    //获取老师的所有课程
    @Override
    public void getCourseData(Callback<Result<List<CourseData>>> callback, String id, String token) {
        subjectApi.getCourseData(id, token).enqueue(callback);
    }

    //删除题目
    @Override
    public void delCourseSub(Callback<Result> callback,String subject_id,String id, String token){
        subjectApi.delCourseSub(subject_id,id,token).enqueue(callback);
    }

    @Override
    public void getTem(Callback<ResponseBody> callback) {
        subjectApi.getTem().enqueue(callback);
    }


    @Override
    public void upload(Callback<Result<List<BulkImport>>> callback, MultipartBody.Part file, RequestBody courseId){
        subjectApi.upload(file,courseId).enqueue(callback);
    }

    @Override
    public void updateSubInfo(Callback<Result<String>> callback,SubjectDataReq subjectDataReq){
        subjectApi.updateSubInfo(subjectDataReq).enqueue(callback);
    }

    @Override
    public void addSub(Callback<Result> callback, SubjectDataListReq subjectDataListReqs){
        subjectApi.addSub(subjectDataListReqs).enqueue(callback);
    }

    @Override
    public void getCourseSub(Callback<Result<List<SubjectTest>>> callback, String courseId, String id, String token
    ,Integer currentPage,Integer rows,String keyword) {
        subjectApi.getCourseSub(courseId,id,token,currentPage,rows,keyword).enqueue(callback);
    }

    @Override
    public void getCourseTargetRecord(Callback<Result<List<CourseTargetRecord>>> callback, String courseId, String id, String token) {
        subjectApi.getCourseTargetRecord(courseId,id,token).enqueue(callback);
    }

    @Override
    public void getCourseChapterList(Callback<Result<List<CourseChapter>>> callback, String courseId, String id, String token) {
        subjectApi.getCourseChapterList(courseId,token,id).enqueue(callback);
    }

    @Override
    public void getQuesTypeList(Callback<Result<List<QuestionTypeRecord>>> callback, String token, String id) {
        subjectApi.getQuesTypeList(token,id).enqueue(callback);
    }

//    @Override
//    public void paperpic(Callback<Result<File>> callback,String paperId) {
//        subjectApi.paperpic(paperId).enqueue(callback);
//    }
}
